from django.core.management.base import BaseCommand
from file_manager.utils import rebuild_file_index

class Command(BaseCommand):
    help = '全量重建文件索引表（FileIndex）以加速搜索'

    def handle(self, *args, **options):
        count = rebuild_file_index()
        self.stdout.write(self.style.SUCCESS(f'索引重建完成，共索引 {count} 个文件/目录。')) 